Curve Fitting and Drawing Example
Curve Fitting and Drawing

FILE: Xyscat.cln

Introduction

When you have a set of data points representing a function and you want to use them in a calculation you have several options.

You could use the data directly by plotting it on a calculation graph (see XY Scatter Calculation and Polar Calculation Graphs).

You can place the data in a table and use the Lookup Object to access the data (this has an option to find the nearest match).

You can approximate the data points by fitting a line or curve to them.

This example is the last of those, it shows how to fit a straight line to a set of XY data points and then plots the straight line onto a graph, together with the original data points.

Click on any part you need help with.

Notice that the equation (the pipe is shown in pink) is fed directly into the XY Scatter Graph object. This graph can plot equations without any preprocessing.


This is an Input Table, used to get the original set of XY data points into the sheet. Notice that the X and Y headings are not part of the data. The Input Table has been set to remove these.


This is a Curve Fit object. It is used here to fit a straight line, but infact it can fit many curve types.

The output from this object is an equation (for this example the equation 4.66461784 + 0.67079187*x).

This equation is fed into a Chi-Square object to test how good a fit it is, and also into the XY Scatter Graph to plot the line for the function.


This is a Chi-Square goodness of fit test. It tests how good and approximation the equation is to the data points. To do this it needs the original data points fed into inlet A and the equation fed into inlet B.


This is an XY Scatter Graph. It displays a set of XY data points optionally joined by lines. Here it is displaying two separate series - the original data points and the equation of the line.

To display the equation, the series style has been set to a single solid line with no markers drawn at the data points.


The result of the Chi-Square goodness of fit test is displayed in this Output Table.

Results closer to 1 are a worse fit, closer to zero are a better fit.